const app = getApp()

Component({
  properties: {
    // show: { type: Boolean, value: true }
  },
  data: {
    navInputValue: ''
  },
  ready () {
    
  },
  methods: {
    async handleNavSearch () {
      if (this.data.navInputValue.length) {
        const res = await app.http.get('/api/v1/getZhenshu?num=' + this.data.navInputValue)
        // console.log(res)
        if (res.code == 0) {
          wx.setStorageSync('zs', res.data)
          wx.navigateTo({
            url: '/pages/zs/zs',
          })
        } else {
          app.helper.msg(res.message)
        }
      } else {
        app.helper.msg('请输入证书编号')
      }
    },
    async handleNavScan () {
      const res = await app.helper.scan()
      this.setData({ navInputValue: res })
      await this.handleNavSearch()
    }
  }
})
